package com.hsh.maoduo.controller;

import com.hsh.maoduo.common.Result;
import com.hsh.maoduo.pojo.vo.UserVO;
import com.hsh.maoduo.service.UserService;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.UsernamePasswordToken;
import org.apache.shiro.subject.Subject;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import javax.validation.Valid;

@RestController
@RequestMapping("/user")
public class UserController {

    @Resource
    private UserService userService;

    @PostMapping("/login")
    public Result login(@Valid UserVO userVO) {
       return userService.login(userVO);
    }

    @PostMapping("/logout")
    public Result logout() {
        return userService.logout();
    }
}
